import type { RouteRecordRaw } from 'vue-router'
import Index from '@/views/index.vue'
import Home from '@/views/home/index.vue'
import Sign from '@/views/sign/index.vue'
import User from '@/views/user/index.vue'
import UserInfo from '@/views/user/user-info.vue'
import UserSetting from '@/views/user/settings.vue'

export const routes: RouteRecordRaw[] = [
    {
        path: '/',
        name: 'Home',
        component: Index,
        children: [
            {
                path: '/',
                name: 'Home',
                component: Home,
            },
            {
                path: '/hot',
                name: 'Hot',
                component: Home,
            },
            {
                path: '/subject',
                name: 'Subject',
                component: Home,
            },
            {
                path: '/d/:id',
                name: 'Detailed',
                component: Home,
            },
            {
                path: '/user',
                name: 'User',
                component: User,
                children: [
                    {
                        path: '/user/:id',
                        name: 'UserInfo',
                        component: () => UserInfo,
                        children: [
                            {
                                path: '/user/:id/:pageId',
                                name: 'UserInfoPage',
                                components: {},
                            },
                        ],
                    },
                    {
                        path: '/user/settings',
                        name: 'UserSetting',
                        component: UserSetting,
                        children: [
                            {
                                path: ':pageId',
                                components: {
                                    profile: () =>
                                        import(
                                            '@/views/user/setting-page/profile.vue'
                                        ),
                                    account: () =>
                                        import(
                                            '@/views/user/setting-page/account.vue'
                                        ),
                                    password: () =>
                                        import(
                                            '@/views/user/setting-page/password.vue'
                                        ),
                                    privacy: () =>
                                        import(
                                            '@/views/user/setting-page/privacy.vue'
                                        ),
                                    block: () =>
                                        import(
                                            '@/views/user/setting-page/block.vue'
                                        ),
                                },
                            },
                        ],
                    },
                ],
            },
        ],
    },
    {
        path: '/',
        name: 'SignIn',
        component: Sign,
        children: [
            {
                path: '/sign-up',
                name: 'SignUp',
                component: () => import('@/views/sign/sign-up.vue'),
            },
            {
                path: '/sign-in',
                name: 'SignIn',
                component: () => import('@/views/sign/sign-in.vue'),
            },
        ],
    },
]
